﻿using PropertyChanged;
using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace GEPL.StandardModulesLibrary.ViewModels.Common
{
    [ImplementPropertyChanged]
    public class LoopViewModel
    {
        public ObservableCollection<KeyValuePair<string, string>> ConditionsList { get; set; }

        public bool IsEnd { get; set; }

        public bool ForLoop { get; set; }

        public bool WhileLoop { get; set; }

        public bool DoWhileLoop { get; set; }

        #region For loop

        public int RangeFrom { get; set; }

        public int RangeTo { get; set; }

        public string Variable { get; set; }

        #endregion For loop

        #region While loop

        public string WhileConditionValue1 { get; set; }

        public string WhileConditionValue2 { get; set; }

        public string SelectedWhileCondition { get; set; }

        #endregion While loop

        public LoopViewModel()
        {
            IsEnd = false;
            WhileLoop = false;
            DoWhileLoop = false;
            ForLoop = true;
            RangeFrom = 1;
            RangeTo = 10;
            InitConditionsList();
        }

        private void InitConditionsList()
        {
            ConditionsList = new ObservableCollection<KeyValuePair<string, string>>
            {
                new KeyValuePair<string, string>("==", Properties.Resources.Conditions_Equals),
                new KeyValuePair<string, string>("!=", Properties.Resources.Conditions_NotEquals),
                new KeyValuePair<string, string>(">", Properties.Resources.Conditions_GreaterThan),
                new KeyValuePair<string, string>(">=", Properties.Resources.Conditions_GreaterOrEqual),
                new KeyValuePair<string, string>("<", Properties.Resources.Conditions_LowerThan),
                new KeyValuePair<string, string>("<=", Properties.Resources.Conditions_LowerOrEqual),
                new KeyValuePair<string, string>("in", Properties.Resources.Conditions_In)
            };
        }
    }
}